<?php
$from = (($page - 1) * max_picture);
$select = 'name,name_rewrite,url_hinh,metaDescription';
$table = 'menu';
$where = "`delete`=0 AND status=1 AND parent_id='{$row_menu_one['id']}'";
$limit = "LIMIT {$from},".max_picture;

include_once('blocks/navigator.php');
$list = $tc->list_item($select,$table,$where,$limit);
$total_list = mysql_num_rows($list);
if($total_list > 1){
	$view_post .= '<div id="tuvan_sk"><h1>'.$row_menu_one['title'].'</h1><h2>'.$row_menu_one['metaDescription'].'</h2>';
	while($row = mysql_fetch_array($list)){
		($row['url_hinh']!='') ? $image=url_catalog_image.$row['url_hinh'] : $image=url_no_image;
		$view_post .= '
		<div class="item_info">
			<a href="'.$row_menu_one['url'].$row['name_rewrite'].'.html"><img src="'.$image.'" alt="'.$row['name'].'" />
			<h3>'.$row['name'].'</h3></a>
			<div>'.$row['metaDescription'].'</div>
		</div>';
	}
	$view_post .= '<div style="clear:both; height:1px"></div></div>';
	mysql_free_result($list);
	$phantrang = $tc->phantrang($row_menu_one['url'],$page,max_picture,'id',$table,$where);
	$view_post .= "<div id=\"phantrang\">{$phantrang}</div>";
}elseif($total_list == 1){
	$row = mysql_fetch_array($list);
	header('location:http://'.$domain.'/'.$row_menu_one['url'].$row['name_rewrite'].'.html');
}else $view_post .= '<p style="padding:0 0 30px 30px">Thông tin đang được cập nhật...</p>';